load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "pfsdb",
    srcs = [
        "branches.go",
        "commit_provenance.go",
        "commits.go",
        "common.go",
        "model.go",
        "pfsdb.go",
        "projects.go",
        "repos.go",
    ],
    importpath = "github.com/pachyderm/pachyderm/v2/src/internal/pfsdb",
    visibility = ["//src:__subpackages__"],
    deps = [
        "//src/internal/authdb",
        "//src/internal/collection",
        "//src/internal/dbutil",
        "//src/internal/errors",
        "//src/internal/errutil",
        "//src/internal/log",
        "//src/internal/pachsql",
        "//src/internal/pbutil",
        "//src/internal/pgjsontypes",
        "//src/internal/randutil",
        "//src/internal/stream",
        "//src/internal/uuid",
        "//src/internal/watch/postgres",
        "//src/pfs",
        "//src/server/pfs",
        "@com_github_jackc_pgconn//:pgconn",
        "@com_github_jmoiron_sqlx//:sqlx",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//status",
        "@org_golang_google_protobuf//proto",
        "@org_golang_google_protobuf//types/known/timestamppb",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "pfsdb_test",
    srcs = [
        "branches_test.go",
        "commit_provenance_test.go",
        "commits_test.go",
        "projects_test.go",
        "repos_test.go",
    ],
    shard_count = 4,
    deps = [
        ":pfsdb",
        "//src/internal/client",
        "//src/internal/clusterstate",
        "//src/internal/clusterstate/v2.6.0:v2_6_0",
        "//src/internal/collection",
        "//src/internal/dbutil",
        "//src/internal/dockertestenv",
        "//src/internal/errors",
        "//src/internal/migrations",
        "//src/internal/pachsql",
        "//src/internal/pctx",
        "//src/internal/protoutil",
        "//src/internal/require",
        "//src/internal/stream",
        "//src/internal/testetcd",
        "//src/internal/testutil/random",
        "//src/internal/uuid",
        "//src/pfs",
        "@com_github_google_go_cmp//cmp",
        "@com_github_google_go_cmp//cmp/cmpopts",
        "@org_golang_google_protobuf//proto",
        "@org_golang_google_protobuf//testing/protocmp",
        "@org_golang_google_protobuf//types/known/timestamppb",
    ],
)
